package com.lc.docker.service;

import com.lc.docker.dao.StudentDao;
import com.lc.docker.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liuc
 * @date 2021/9/6
 * @description
 **/
@Service
public class StudentService {
    @Autowired
    private StudentDao studentDao;

    public List<Student> list(){
        return studentDao.findAll();
    }

    public int add(Student student){
        return studentDao.save(student).getId();
    }

    public boolean del(int id){
        studentDao.deleteById(id);
        return true;
    }

    public void update(Student student){
        studentDao.save(student);
    }

}
